using System;
using System.ComponentModel;
using System.Collections.Generic;

using SBPweb.Modules.Modularity;

namespace SBPweb.Contracts
{
	/// <summary>
	/// Interface of ISessionDataManagerService
	/// </summary>
	public interface ISessionDataManagerService : IService
    {
		/// <summary>
		/// Gather data
		/// </summary>
        void GatherData();

		/// <summary>
		/// Event for data gathering start
		/// </summary>
        event EventHandler<CancelDataGatherEventArgs> OnDataGathering;
		/// <summary>
		/// Event for data gathering end
		/// </summary>
        event EventHandler<DataGatherEventArgs> OnDataGathered;
    }

	/// <summary>
	/// This class represents the data gathering event args.
	/// </summary>
    public class DataGatherEventArgs : EventArgs
    {
        private List<string> pKeys;

		/// <summary>
		/// This class represents the data gathering event args.
		/// </summary>
		/// <param name="key">key of the data</param>
        public DataGatherEventArgs(string key)
            : this(new List<string>(new string[] { key }))
        {
        }

		/// <summary>
		/// This class represents the data gathering event args.
		/// </summary>
		/// <param name="keys">list of keys of datas</param>
        public DataGatherEventArgs(List<string> keys)
        {
            pKeys = keys;
        }

		/// <summary>
		/// List of keys
		/// </summary>
        public List<string> Keys
        {
            get
            {
                return pKeys;
            }
        }
    }

	/// <summary>
	/// This class represents the data gathering cancel event args.
	/// </summary>
    public class CancelDataGatherEventArgs : CancelEventArgs
    {
        private List<string> pKeys;

		/// <summary>
		/// This class represents the data gathering cancel event args.
		/// </summary>
		/// <param name="key">key of the gathered data</param>
        public CancelDataGatherEventArgs(string key)
            : this(new List<string>(new string[] { key }))
        {
        }

		/// <summary>
		/// This class represents the data gathering cancel event args.
		/// </summary>
		/// <param name="keys">list of the keys of datas</param>
        public CancelDataGatherEventArgs(List<string> keys)
        {
            pKeys = keys;
        }

		/// <summary>
		/// This class represents the data gathering cancel event args.
		/// </summary>
		/// <param name="args">data gathering event args</param>
        public CancelDataGatherEventArgs(DataGatherEventArgs args)
        {
            pKeys = args.Keys;
        }

		/// <summary>
		/// List of keys
		/// </summary>
        public List<string> Keys
        {
            get
            {
                return pKeys;
            }
        }
    }
}